<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function sendAjax() {
            var xhr = new XMLHttpRequest();
            xhr.onreadystatechange = function(){
                if(xhr.readyState==4 && xhr.status==200){
                    var res = JSON.parse(xhr.responseText)

                    if(res.status == 1){
                        // console.log(res.data)
                        for(var user of res.data){
                            console.log(user)
                        }

                    }else{
                        console.log(res.message)
                    }
                }
            }
            xhr.open("post","ajax")
            xhr.send()
        }
    </script>
</head>
<body>
    <button onclick="sendAjax()">发送Ajax请求</button>
</body>
</html>